package cn.com.qiancheng.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.com.qiancheng.dao.EvaluationDao;
import cn.com.qiancheng.dao.ExamPaperDao;
import cn.com.qiancheng.dto.Evaluation;
import cn.com.qiancheng.dto.ExamPaper;

/**
 * Servlet implementation class Emaxpaper
 */
public class ExampaperServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public ExampaperServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String paper = request.getParameter("paper");
		EvaluationDao epd = new EvaluationDao();
		Evaluation ep = null;
		ep = epd.sreachEvaluation((Integer.parseInt(paper)));
		if (ep != null) {
			request.setAttribute("pap", ep);
			RequestDispatcher rd = request.getRequestDispatcher("WEB-INF/JSP/test1.jsp");
			rd.forward(request, response);
		}

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}

}
